package com.ltmonitor.service.impl;

import com.ltmonitor.dao.IAlarmConfigDao;
import com.ltmonitor.dao.IVehicleStateIconConfigDao;
import com.ltmonitor.entity.AlarmConfig;
import com.ltmonitor.entity.VehicleStateIcon;
import com.ltmonitor.service.IAlarmConfigService;
import com.ltmonitor.service.IDepartmentService;
import com.ltmonitor.service.IVehicleStateIconConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 报警配置服务
 * 
 * @author admin
 *
 */

@Service("vehicleStateIconConfigService")
public class VehicleStateIconConfigService extends BaseService<Long, VehicleStateIcon>
		implements IVehicleStateIconConfigService {
	@Autowired
	private IVehicleStateIconConfigDao vehicleStateIconConfigDao;


	@Override
	public List<VehicleStateIcon> getVehicleStateIconList() {

		String queryString = "from VehicleStateIcon b  order by b.vehicleType, vehicleStatus ASC";
		return this.query(queryString);
	}


	public VehicleStateIcon getVehicleStateIcon(String vehicleType, String vehicleStatus ) {
		String hql = "from VehicleStateIcon where vehicleType = ? and vehicleStatus = ?";
		VehicleStateIcon stateIcon = (VehicleStateIcon) this
				.find(hql, new Object[] { vehicleType, vehicleStatus });
		if (stateIcon == null) {
			hql = "from VehicleStateIcon where defaultVehicleType = ? and vehicleStatus = ?";
			stateIcon = (VehicleStateIcon) this.find(hql,
					new Object[] { true, vehicleStatus });
		}
		return stateIcon;
	}
}
